﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace 红黑树
{
    public enum Color
    {
        red,black
    }
    class RBTreeNode    //节点
    {
        public int key;
        public RBTreeNode left;
        public RBTreeNode right;
        public Color color;

        //由于红黑树需要寻找父节点和祖父节点以及叔节点
        //因而需要多设置一个Parent节点来方便操作
        public RBTreeNode parent;
        public RBTreeNode(int item,Color color)
        {
            key = item;
            left = null;
            right = null;
            this.color = color;
        }
        public override string ToString()
        {
            return key + "(" + color.ToString() + ")";
        }
    }
}
